﻿
@{
    ViewBag.Title = "Update";
    Layout = "~/Areas/admin/Views/Shared/_Layout.cshtml";
    One_day.Models.Table product = ViewBag.product;
    List<One_day.Models.T_Shop_Category> cate = (List<One_day.Models.T_Shop_Category>)ViewBag.category;
}

<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">修改商品信息</h1>
        </div>
    </div>
    <div class="row">
        <div style="padding:20px;">
            <form action="/admin/product/UpdateSave" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <label for="ProductName">ProductName</label>
                    <input type="text" class="form-control" id="ProductName" name="ProductName" placeholder="商品名称" value="@product.ProductName">
                </div>
                <div class="form-group">
                    <label for="Price">Price</label>
                    <input type="text" class="form-control" id="Price" name="Price" placeholder="商品价钱" value="@product.Price">
                </div>
                <div class="form-group">
                    <label for="SelledAmount">SelledAmount</label>
                    <input type="text" class="form-control" id="SelledAmount" name="SelledAmount" placeholder="已卖商品数量" value="@product.SelledAmount">
                </div>
                <div class="form-group">
                    <label for="StockAmount">StockAmount</label>
                    <input type="text" class="form-control" id="StockAmount" name="StockAmount" placeholder="商品剩余库存" value="@product.StockAmount">
                </div>
                <div class="form-group">
                    <label for="CategoryId">CategoryId</label>
                    <select name="CategoryId" id="CategoryId">
                        @{
                            foreach (var item in cate)
                            {
                                if (item.Id == product.CategoryId)
                                {
                                    <option value="@item.Id" selected="selected">@item.CatagoryName</option>
                                }
                                else
                                {
                                    <option value="@item.Id">@item.CatagoryName</option>
                                }
                            }
                        }
                    </select>
                </div>
                <div class="form-group">
                    <label for="PicUrl">PicUrl</label>
                    <img src="~/Upload//@product.PicUrl" style="width:40px;height:40px;" />
                    <input type="file" class="form-control" id="PicUrl" name="PicUrl" placeholder="商品图片">
                    <input type="hidden" class="form-control" id="id" name="id" value="@product.Id">
                </div>
                <button type="submit" class="btn btn-default">提交</button>
            </form>
        </div>
    </div>
</div>

